package org.feng.config;

import org.feng.service.ColumnService;
import org.feng.service.DynamicDataSourceService;
import org.feng.service.TableService;
import org.springframework.ai.tool.ToolCallbackProvider;
import org.springframework.ai.tool.method.MethodToolCallbackProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 服务提供者配置
 */
@Configuration
public class ServiceProviderConfig {
    @Autowired
    private TableService tableService;
    @Autowired
    private ColumnService columnService;
    @Autowired
    private DynamicDataSourceService dynamicDataSourceService;


    @Bean
    public ToolCallbackProvider serverTools() {
        return MethodToolCallbackProvider.builder()
                // 可以注册多个服务
                .toolObjects(tableService, columnService, dynamicDataSourceService)
                .build();
    }
}

